home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / axnteven / frwriter.frm < prev    next >
Text File  |  1999-03-29  |  4KB  |  158 lines

  1. VERSION 5.00
  2. Object = "{97746B1E-E2AE-11D2-9A51-00000100C2E6}#1.0#0"; "AxEvntLg.ocx"
  3. Begin VB.Form FrmWriter 
  4.    Caption         =   "Event writer"
  5.    ClientHeight    =   3795
  6.    ClientLeft      =   60
  7.    ClientTop       =   345
  8.    ClientWidth     =   4590
  9.    LinkTopic       =   "Form1"
  10.    ScaleHeight     =   3795
  11.    ScaleWidth      =   4590
  12.    StartUpPosition =   3  'Windows Default
  13.    Begin AxEvntLg.AxNTEventLog NTEventLogX 
  14.       Left            =   1380
  15.       Top             =   1200
  16.       MachineName     =   ""
  17.       SourceName      =   "Application"
  18.       Active          =   0   'False
  19.       BackupFileName  =   ""
  20.       IncludeUserName =   -1  'True
  21.    End
  22.    Begin VB.CheckBox cbxInclude 
  23.       Caption         =   "Include User name"
  24.       Height          =   255
  25.       Left            =   1260
  26.       TabIndex        =   8
  27.       Top             =   2520
  28.       Width           =   2175
  29.    End
  30.    Begin VB.CommandButton btnFull 
  31.       Caption         =   "Write message"
  32.       Height          =   375
  33.       Left            =   60
  34.       TabIndex        =   7
  35.       Top             =   3360
  36.       Width           =   4455
  37.    End
  38.    Begin VB.CommandButton btnSimple 
  39.       Caption         =   "Write simple message"
  40.       Height          =   375
  41.       Left            =   60
  42.       TabIndex        =   6
  43.       Top             =   2880
  44.       Width           =   4455
  45.    End
  46.    Begin VB.ComboBox cmbEventType 
  47.       Height          =   315
  48.       Left            =   1260
  49.       Style           =   2  'Dropdown List
  50.       TabIndex        =   4
  51.       Top             =   2100
  52.       Width           =   3255
  53.    End
  54.    Begin VB.TextBox memStrings 
  55.       Height          =   1155
  56.       Left            =   60
  57.       MultiLine       =   -1  'True
  58.       TabIndex        =   3
  59.       Top             =   840
  60.       Width           =   4455
  61.    End
  62.    Begin VB.ComboBox cmbComputer 
  63.       Height          =   315
  64.       Left            =   1260
  65.       Style           =   2  'Dropdown List
  66.       TabIndex        =   0
  67.       Top             =   120
  68.       Width           =   3255
  69.    End
  70.    Begin VB.Label Label3 
  71.       Caption         =   "Event Type"
  72.       Height          =   255
  73.       Left            =   120
  74.       TabIndex        =   5
  75.       Top             =   2160
  76.       Width           =   915
  77.    End
  78.    Begin VB.Label Label2 
  79.       Caption         =   "Text to write"
  80.       Height          =   195
  81.       Left            =   120
  82.       TabIndex        =   2
  83.       Top             =   600
  84.       Width           =   975
  85.    End
  86.    Begin VB.Label Label1 
  87.       Caption         =   "Computer"
  88.       Height          =   255
  89.       Left            =   120
  90.       TabIndex        =   1
  91.       Top             =   180
  92.       Width           =   915
  93.    End
  94. End
  95. Attribute VB_Name = "FrmWriter"
  96. Attribute VB_GlobalNameSpace = False
  97. Attribute VB_Creatable = False
  98. Attribute VB_PredeclaredId = True
  99. Attribute VB_Exposed = False
  100. Private Sub btnFull_Click()
  101.   
  102.   NTEventLogX.MachineName = cmbComputer.Text
  103.   NTEventLogX.Active = True
  104.   EventType = 1
  105.   For i = 0 To cmbEventType.ListIndex - 1
  106.     EventType = EventType * 2
  107.   Next i
  108.   
  109.   
  110.  
  111.   Set WriteObject = NTEventLogX.WriteObject
  112.   WriteObject.EventId = 1000
  113.   WriteObject.EventType = EVT_ERROR
  114.   WriteObject.EventCategory = 2
  115.   WriteObject.Strings.Text = memStrings.Text
  116.   WriteObject.DataBytes.Clear
  117.   For i = 0 To 3
  118.     WriteObject.DataBytes.Add (i)
  119.   Next i
  120.   
  121.   Call NTEventLogX.AddObject(WriteObject)
  122.   
  123.   NTEventLogX.Active = False
  124.  
  125. End Sub
  126.  
  127. Private Sub btnSimple_Click()
  128.   NTEventLogX.MachineName = cmbComputer.Text
  129.   NTEventLogX.Active = True
  130.   EventType = 1
  131.   For i = 0 To cmbEventType.ListIndex - 1
  132.     EventType = EventType * 2
  133.   Next i
  134.  
  135.   Call NTEventLogX.Add(EventType, memStrings.Text)
  136.   NTEventLogX.Active = False
  137. End Sub
  138.  
  139. Private Sub cbxInclude_Click()
  140.   NTEventLogX.IncludeUserName = Not (cbxInclude.Value = 0)
  141. End Sub
  142.  
  143. Private Sub Form_Load()
  144.   Set List = NTEventLogX.GetServers("")
  145.   For i = 0 To List.Count - 1
  146.     cmbComputer.AddItem (List.Item(i))
  147.   Next i
  148.  
  149. cmbEventType.AddItem ("SUCCESS")
  150. cmbEventType.AddItem ("ERROR")
  151. cmbEventType.AddItem ("WARNING")
  152. cmbEventType.AddItem ("Information")
  153. cmbEventType.AddItem ("AUDIT_SUCCESS")
  154. cmbEventType.AddItem ("AUDIT_FAILURE")
  155. cmbEventType.ListIndex = 0
  156.  
  157. End Sub
  158.